package com.aaron.sqlsession.impl;

import com.aaron.config.*;
import com.aaron.sqlsession.SqlSessionFactory;
import org.dom4j.DocumentException;

import java.beans.PropertyVetoException;
import java.io.InputStream;

/**
 * @Description
 * @Author Aaron
 * @Version V1.0.0
 * @Since 1.0
 * @Date 2021/10/30
 */
public class SqlSessionFactoryBuilder {

    public SqlSessionFactory builder(InputStream inputStream) throws PropertyVetoException, DocumentException, ClassNotFoundException {
        XmlParseConfig xmlParse = new XmlParseConfig();
        Configuration config = xmlParse.getConfiguration(inputStream);
        SqlSessionFactory sqlSessionFactory = new DefaultSqlSessionFactory(config);
        return sqlSessionFactory;
    }

}
